package operation;

import book.BookList;

import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 东莞呵呵
 * Date:2022-05-19
 * Time:21:12
 */
public class BorrowOperation implements IOperation{
    @Override
    public void work(BookList books) {
        System.out.println("借阅书籍");
        System.out.println("请输入要借阅的书籍书名->");
        Scanner scanner=new Scanner(System.in);
        String name= scanner.nextLine();
        for (int i = 0; i < books.getSize(); i++) {
            if(books.getBook(i).getName().equals(name)){
                books.getBook(i).setBorrowed(true);
                System.out.println("已经把"+name+"借出");
            }
        }
    }
}
